package siga.visao_financeiro;

import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import siga.banco.conexao;
import siga.visao.index;
import siga.visao.verErros;
import siga.visao_busca.*;

/**
 *
 * @author rafaelfrasson
 */
public class movCaixaPagarEditarVer extends javax.swing.JDialog {

    public String cod_lanc;
    public boolean finaliza=false;
    public movCaixaPagarEditarVer(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpMCEVPrincipal = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jtfCodigo = new javax.swing.JTextField();
        jtfPessoa = new javax.swing.JTextField();
        jtfDtVenc = new javax.swing.JFormattedTextField();
        jtfCentroCusto = new javax.swing.JTextField();
        jtfPlanoContas = new javax.swing.JTextField();
        jtfValor = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtfHistorico = new javax.swing.JTextPane();
        jbPlanoContas = new javax.swing.JButton();
        jbCentroCusto = new javax.swing.JButton();
        jbPessoa = new javax.swing.JButton();
        jbCancelar = new javax.swing.JButton();
        jbSalvar = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        jtfDtpgto = new javax.swing.JFormattedTextField();
        jtfJuros = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jtfVlPgto = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Editar Boleto");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        jpMCEVPrincipal.setFont(new java.awt.Font("SansSerif", 0, 11));
        jpMCEVPrincipal.setName("jpMCEVPrincipal"); // NOI18N
        jpMCEVPrincipal.setNextFocusableComponent(jtfDtVenc);

        jLabel1.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel1.setText("Código:");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel2.setText("Pessoa:");
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel3.setText("Histórico:");
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel4.setText("Data de Vencimento:");
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel5.setText("Valor Bruto:");
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel7.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel7.setText("Centro de Custo:");
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel8.setText("Plano de Contas:");
        jLabel8.setName("jLabel8"); // NOI18N

        jtfCodigo.setEditable(false);
        jtfCodigo.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfCodigo.setName("jtfCodigo"); // NOI18N

        jtfPessoa.setEditable(false);
        jtfPessoa.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfPessoa.setName("jtfPessoa"); // NOI18N

        try {
            jtfDtVenc.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jtfDtVenc.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jtfDtVenc.setName("jtfDtVenc"); // NOI18N

        jtfCentroCusto.setEditable(false);
        jtfCentroCusto.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfCentroCusto.setName("jtfCentroCusto"); // NOI18N

        jtfPlanoContas.setEditable(false);
        jtfPlanoContas.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfPlanoContas.setName("jtfPlanoContas"); // NOI18N

        jtfValor.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfValor.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jtfValor.setText("0,00");
        jtfValor.setName("jtfValor"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jtfHistorico.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfHistorico.setName("jtfHistorico"); // NOI18N
        jScrollPane1.setViewportView(jtfHistorico);

        jbPlanoContas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siga/imagem/busca_16x16.png"))); // NOI18N
        jbPlanoContas.setName("jbPlanoContas"); // NOI18N
        jbPlanoContas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPlanoContasActionPerformed(evt);
            }
        });

        jbCentroCusto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siga/imagem/busca_16x16.png"))); // NOI18N
        jbCentroCusto.setName("jbCentroCusto"); // NOI18N
        jbCentroCusto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbCentroCustoActionPerformed(evt);
            }
        });

        jbPessoa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siga/imagem/busca_16x16.png"))); // NOI18N
        jbPessoa.setName("jbPessoa"); // NOI18N
        jbPessoa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbPessoaActionPerformed(evt);
            }
        });

        jbCancelar.setText("Cancelar");
        jbCancelar.setToolTipText("Cancela a Ação");
        jbCancelar.setName("jbCancelar"); // NOI18N
        jbCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbCancelarActionPerformed(evt);
            }
        });

        jbSalvar.setText("Confirmar");
        jbSalvar.setToolTipText("Confirma a Ação");
        jbSalvar.setName("jbSalvar"); // NOI18N
        jbSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbSalvarActionPerformed(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel9.setText("Data de Pagamento:");
        jLabel9.setName("jLabel9"); // NOI18N

        try {
            jtfDtpgto.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jtfDtpgto.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jtfDtpgto.setName("jtfDtpgto"); // NOI18N

        jtfJuros.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfJuros.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jtfJuros.setText("0,00");
        jtfJuros.setName("jtfJuros"); // NOI18N

        jLabel6.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel6.setText("Juros:");
        jLabel6.setName("jLabel6"); // NOI18N

        jtfVlPgto.setFont(new java.awt.Font("SansSerif", 0, 11));
        jtfVlPgto.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jtfVlPgto.setText("0,00");
        jtfVlPgto.setName("jtfVlPgto"); // NOI18N

        jLabel10.setFont(new java.awt.Font("SansSerif", 0, 11));
        jLabel10.setText("Valor Pgto:");
        jLabel10.setName("jLabel10"); // NOI18N

        javax.swing.GroupLayout jpMCEVPrincipalLayout = new javax.swing.GroupLayout(jpMCEVPrincipal);
        jpMCEVPrincipal.setLayout(jpMCEVPrincipalLayout);
        jpMCEVPrincipalLayout.setHorizontalGroup(
            jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2)
                            .addComponent(jtfCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jtfDtVenc, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jtfDtpgto, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING)))
                            .addComponent(jtfPessoa, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbPessoa, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addGap(187, 187, 187)
                        .addComponent(jbSalvar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbCancelar))
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jtfPlanoContas, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
                            .addComponent(jtfCentroCusto, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jbPlanoContas, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbCentroCusto, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel7)
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jtfValor, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtfJuros, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jtfVlPgto, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE)
                    .addComponent(jLabel3))
                .addGap(22, 22, 22))
        );
        jpMCEVPrincipalLayout.setVerticalGroup(
            jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtfCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtfPessoa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jbPessoa))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtfDtVenc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtfDtpgto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(3, 3, 3)
                        .addComponent(jtfPlanoContas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jbPlanoContas))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addGap(3, 3, 3)
                        .addComponent(jtfCentroCusto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jbCentroCusto))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtfValor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtfJuros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpMCEVPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtfVlPgto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                .addGroup(jpMCEVPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbCancelar)
                    .addComponent(jbSalvar))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jpMCEVPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jpMCEVPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jbCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCancelarActionPerformed
        finaliza=false;
        dispose();
    }//GEN-LAST:event_jbCancelarActionPerformed

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        try {
            conexao.Query("select fr.*,fc.descricao as desc_conta, fp.descricao as desc_custo from fin_contas_mov_p fr " +
                    "left join fin_plano_contas fc on fc.codigo=fr.cod_plano_contas and fc.cod_emp=fr.cod_emp " +
                    "left join fin_plano_centro fp on fr.cod_centro_custos = fp.codigo and fr.cod_emp=fp.cod_emp " +
                    "where fr.cod_emp="+index.cod_emp+" and fr.codigo="+cod_lanc);
            conexao.rs.next();
            jtfCodigo.setText(conexao.rs.getString("codigo"));
            jtfPessoa.setText(index.LRpessoa.get(1).toString());
            jtfDtVenc.setText(new SimpleDateFormat("dd/MM/yyyy").format(conexao.rs.getDate("dt_vencimento")));
            jtfDtpgto.setText((conexao.rs.getString("dt_pagamento") != null)?new SimpleDateFormat("dd/MM/yyyy").format(conexao.rs.getDate("dt_pagamento")):"");
            jtfHistorico.setText((conexao.rs.getString("descricao") != null)?conexao.rs.getString("descricao"):"");
            index.LRcentro.add(0,conexao.rs.getString("cod_centro_custos"));
            index.LRcentro.add(1,conexao.rs.getString("desc_custo"));
            jtfCentroCusto.setText(conexao.rs.getString("desc_custo"));
            index.LRcontas.add(0, conexao.rs.getString("cod_plano_contas"));
            index.LRcontas.add(1, conexao.rs.getString("desc_conta"));
            jtfPlanoContas.setText(conexao.rs.getString("desc_conta"));
            jtfValor.setText(index.ftbr.format(conexao.rs.getDouble("valor_bruto")));
            jtfJuros.setText((conexao.rs.getString("juros") != null)?index.ftbr.format(conexao.rs.getDouble("juros")):"0,00");
            jtfVlPgto.setText((conexao.rs.getString("valor") != null)?index.ftbr.format(conexao.rs.getDouble("valor")):"0,00");
        } catch (SQLException ex) {
            verErros.setErro(ex.getMessage());
        }
    }//GEN-LAST:event_formWindowActivated

    private void jbSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbSalvarActionPerformed
        try {
            String datav = (!jtfDtVenc.getText().equals("  /  /    "))?",dt_vencimento=\""+new SimpleDateFormat("yyyy-MM-dd").format(new SimpleDateFormat("dd/MM/yyyy").parse(jtfDtVenc.getText()))+" 00:00:00\"":"";
            String datap = (!jtfDtpgto.getText().equals("  /  /    "))?",dt_pagamento=\""+new SimpleDateFormat("yyyy-MM-dd").format(new SimpleDateFormat("dd/MM/yyyy").parse(jtfDtpgto.getText()))+" 00:00:00\"":"";
            String valor = (index.ftes.parse(jtfValor.getText()).doubleValue()>0)?",valor_bruto=\""+index.ftes.parse(jtfValor.getText()).doubleValue()+"\"":"";
            String valorj = (index.ftes.parse(jtfJuros.getText()).doubleValue()>0)?",juros=\""+index.ftes.parse(jtfJuros.getText()).doubleValue()+"\"":"";
            String valorl = (index.ftes.parse(jtfVlPgto.getText()).doubleValue()>0)?",valor=\""+index.ftes.parse(jtfVlPgto.getText()).doubleValue()+"\"":"";
            conexao.stm.executeUpdate("update fin_contas_mov_p set descricao=\""+jtfHistorico.getText()+"\" "+datav+datap+valor+valorj+valorl+" where cod_emp="+index.cod_emp+" and codigo="+jtfCodigo.getText());
            finaliza=true;
            dispose();
        } catch (ParseException ex) {
            verErros.setErro(ex.getMessage());
        } catch (SQLException ex) {
            verErros.setErro(ex.getMessage());
        }

    }//GEN-LAST:event_jbSalvarActionPerformed

    private void jbPessoaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPessoaActionPerformed
        buscaVer bv = new buscaVer(null,true);
        buscaVer.setTipo("");
        bv.setLocation((index.tela.width-bv.getWidth())/2, (index.tela.height-bv.getHeight())/2);
        bv.setVisible(true);
        if(buscaVer.isConfirmaBusca()){
            jtfPessoa.setText(index.LRpessoa.get(1).toString());
        }
    }//GEN-LAST:event_jbPessoaActionPerformed

    private void jbPlanoContasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPlanoContasActionPerformed
        buscaPlanoContas bv = new buscaPlanoContas(null,true);
        bv.setLocation((index.tela.width-bv.getWidth())/2, (index.tela.height-bv.getHeight())/2);
        bv.setVisible(true);
        if(buscaPlanoContas.isConfirmaContas()){
            jtfPlanoContas.setText(index.LRcontas.get(1).toString());
        }
    }//GEN-LAST:event_jbPlanoContasActionPerformed

    private void jbCentroCustoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCentroCustoActionPerformed
        buscaCentroCusto bv = new buscaCentroCusto(null,true);
        bv.setLocation((index.tela.width-bv.getWidth())/2, (index.tela.height-bv.getHeight())/2);
        bv.setVisible(true);
        if(buscaCentroCusto.isConfirmaCentro()){
            jtfCentroCusto.setText(index.LRcentro.get(1).toString());
        }
    }//GEN-LAST:event_jbCentroCustoActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbCancelar;
    private javax.swing.JButton jbCentroCusto;
    private javax.swing.JButton jbPessoa;
    private javax.swing.JButton jbPlanoContas;
    private javax.swing.JButton jbSalvar;
    private javax.swing.JPanel jpMCEVPrincipal;
    private javax.swing.JTextField jtfCentroCusto;
    private javax.swing.JTextField jtfCodigo;
    private javax.swing.JFormattedTextField jtfDtVenc;
    private javax.swing.JFormattedTextField jtfDtpgto;
    private javax.swing.JTextPane jtfHistorico;
    private javax.swing.JTextField jtfJuros;
    private javax.swing.JTextField jtfPessoa;
    private javax.swing.JTextField jtfPlanoContas;
    private javax.swing.JTextField jtfValor;
    private javax.swing.JTextField jtfVlPgto;
    // End of variables declaration//GEN-END:variables

}
